using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using YABlog.BLL;

public partial class NewBlog : System.Web.UI.Page
{
    CategoriesAction cat = new CategoriesAction();

    protected void Page_Load(object sender, EventArgs e)
    {
        FreeTextBox1.EnableHtmlMode = false;
        if (Session["UserId"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        if (!IsPostBack)
        {
            cat.GetCategories(drpCategory);
        }
    }

    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx");
    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        EntriesAction entry = new EntriesAction();
        if (txtSubject.Text == "")
        {
            return;
        }
        if (true == entry.InsertEntry(drpCategory.SelectedValue, txtSubject.Text, FreeTextBox1.Text))
        {
            FreeTextBox1.Text = "";
            txtSubject.Text = "";

            Response.Redirect("Default.aspx");
        }
    }
}
